<template>
  <div class="demo1">
    <h1>{{ name | hchSlice }}</h1>
    <h1>{{ age }}</h1>
    <h1>{{ x }}</h1>
    <h2 @click="showName">学生姓名：{{ name }}</h2>
    <button @click="test">查看姓名</button>
    <button @click="sendNameToSchool">把学生名给App</button>
    <br/>
    <input v-model="infos" type="text"/>
  </div>
</template>

<script>
import {hunhe} from "@/mixin/mixin";

export default {
  name: "Student",
  mixins: [hunhe],
  props: {
    name: {
      type: String,
      require: true,
    },
    age: {
      type: Number,
      default: 99
    }
  },
  data() {
    return {
      infos: '',
    }
  },
  methods: {
    test() {
      this.infos = this.hello("我是何聪辉")
    },
    sendNameToSchool() {
      this.$emit("athch", '何聪辉')
    }
  }
}
</script>

<style scoped>
.demo1 {
  background-color: green;
}
</style>